function stOut=lmjMinCsminwel(xzero,estimopt,Y,funcModel,solveOpt,addSol,prpar,prss,StIn)
%
% stOut.LPosterior 
% stOut.mode 
% stOut.exitFlag
% stOut.iterations 
% stOut.Hessian
% stOut.time 
% stOut.info
%
%
% Uses lmjMinCsminwelSub for evaluation of the likelihood 
% Called from the Parallel Loop
% Uses silent csminwel
%
% StIn.parVec        % Parameter Vector with calibrated positions In 
% StIn.parPosEst     % Position of the estimated parameters 
% StIn.transMat      % Transformation Matrix for estimation Parameters Only
% 
% StIn.trainVec      % trainVec training vector 
tic;
%% 1. Assign default values
stOut.LPosterior=inf;
stOut.mode=nan(length(xzero),1);
stOut.iterations=-1;
stOut.exitFlag=-10;
stOut.tiempo=0; 
stOut.Hessian=nan(length(xzero)); 
stOut.info={'Problems at start'}; 
%% 2. Transform XZERO into XZEROMIN, return if any value is imaginary
xzeromin=feval(@mod2min,xzero,StIn.transMat);
if any( imag(xzeromin) ) || any( isnan(xzeromin) )
    disp('Imaginary Starting Value')
    return
end
funcSubOptim=@lmjPosteriorOptimization;
if StIn.flagSilent==0
    funcOptim=@csminwel;
else
    funcOptim=@csminwel_silent;
end
%% 3. Call CSMINWEL
[stOut.LPosterior,xestmin,~,stOut.Hessian,stOut.iterations,~,stOut.exitFlag]=...
    feval(funcOptim,funcSubOptim,xzeromin,0.25*eye(length(xzeromin)),[],estimopt.TolFun,estimopt.MaxIter,...
    Y,funcModel,solveOpt,addSol,prpar,prss,1,StIn); 
%% 4. Retrive stOut.mode, return if any value nan or imaginart
stOut.mode=feval(@min2mod,xestmin,StIn.transMat);
if any( imag(stOut.mode) ) || any( isnan(stOut.mode) )
    stOut.LPosterior=inf;
    stOut.mode=nan(length(xzero),1);
end
stOut.time=toc;